package com.qys.livesMall.common.exception.enums;

import com.qys.livesMall.common.message.QysLang;

/**
 * Created by IntelliJ IDEA.
 * User: dp
 * Date: 2023/05/16
 * Time: 14:26
 * DESCRIPTION: 异常枚举类
 */
public enum ExceptionEnum implements QysLang {
    // 400
    BAD_REQUEST(400, "请求数据格式不正确!"),
    UNAUTHORIZED(401, "登录凭证过期!"),

    REMOTE_LOGIN(409, "账号在另一台设备登陆!"),
    FORBIDDEN(403, "没有访问权限!"),
    NOT_FOUND(404, "请求的资源找不到!"),
    // 500
    INTERNAL_SERVER_ERROR(500, "服务器内部错误!"),
    SERVICE_UNAVAILABLE(503, "服务器正忙，请稍后再试!"),
    // 未知异常
    UNKNOWN(10000, "未知异常!"),
    // 自定义
    IS_NOT_NULL(10001, "%s不能为空"),


    NO_SET_PWD(30001, "未设置密码"),
    PARAM_IS_ERROR(405,"param.is.error"),

    QUANTITY_TOO_MAXIMUM(10002,"quantity.too.maximum"),
    PLATFORM(10003,"live.platform"),
    ;

    private final String PROJECT="common";
    /**
     * 错误码
     */
    private int code;

    /**
     * 错误描述
     */
    private String msg;

    ExceptionEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public String PROJECT() {
        return PROJECT;
    }

    public int getCode() {
        return code;
    }

    @Override
    public String getMsgKey() {
        return msg;
    }

    public String getMsg() {
        return msg;
    }
}
